package com.example.demo77.controller;

import com.example.demo77.entity.Teacher;
import com.example.demo77.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * (Teacher)表控制层
 *
 * @author makejava
 * @since 2020-05-26 09:33:43
 */
@RestController
@RequestMapping("teacher")
public class TeacherController {
    /**
     * 服务对象
     */
    @Resource
    private TeacherService teacherService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Teacher selectOne(Integer id) {
        return this.teacherService.queryById(id);
    }

    @Autowired
    private Teacher teacher;

    @RequestMapping("teacher0")
    @ResponseBody
    public String teacher(){
        return teacher.getId()+" "+ teacher.getAccount() +" "+ Arrays.toString(teacher.getJob());

    }


}